package com.zyz.K_集合.Map接口一HashMap;

import java.util.HashMap;

/**
 * @author: vick
 * @Date: 2025/3/30
 * @Description:
 * @version: 1.0
 */
public class Demo1 {
    public static void main(String[] args) {
        HashMap hashMap = new HashMap();
        //添加
        hashMap.put("001", "aa");
        hashMap.put("002", "bb");
        hashMap.put("003", "cc");
        hashMap.put("004", "dd");
        hashMap.put(005, "dd");
        System.out.println(hashMap);

        //修改
        hashMap.put("003", "ee");
        System.out.println(hashMap);

        //删除
        hashMap.remove(005);
        System.out.println(hashMap);
        int size = hashMap.size();
        System.out.println(size);
        hashMap.clear();
        size = hashMap.size();
        System.out.println(size);

        System.out.println("=====");
        System.out.println(hashMap);
        HashMap hashMap2 = new HashMap();
        //添加
        hashMap.put("001", "aa");
        hashMap.put("002", "bb");
        hashMap.put("003", "cc");
        hashMap.put("004", "dd");
        hashMap.putAll(hashMap2);
        System.out.println(hashMap);
    }
}
